<template>
  <div class="right-toolbar">
    <el-tooltip
      class="item"
      effect="dark"
      content="版本"
      placement="top"
      v-if="historys.length > 0"
    >
      <el-dropdown
        @command="command"
        class="el-button"
        max-height="300px"
        trigger="click"
      >
        <span>
          #{{ prefix }}<el-icon><arrow-down /></el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item
              v-for="(history, index) in historys"
              :key="index"
              :command="history"
              >#{{ index + 1 }}</el-dropdown-item
            >
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </el-tooltip>
  </div>
</template>

<script setup>
const props = defineProps({
  prefix: { type: Number, default: 0 },
  historys: { type: Array, default: () => [] },
  command: { type: Function },
});
</script>
